package com.guanyu.u2cache.controller;

import com.guanyu.u2cache.caffeine.MemoryUseCount;
import com.guanyu.u2cache.model.Result;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhouyunjian
 * @date 2023/12/12 17:40
 **/
@Slf4j
@RestController
@RequestMapping("/memory")
public class CacheMemoryController {

    @GetMapping("/size/")
    public Result memorySize() throws Exception {
        MemoryUseCount count = new MemoryUseCount();
        return Result.success(count.calculateMemorySpace());
    }
}
